package com.dameng;

import org.testng.annotations.*;

/**
 * @author zhl
 * 执行顺序
 Before suite
 Before test
 Before class
 Before slow groups
 Before method
 Slow test
 After method
 After slow groups
 After class
 After test
 After suite
 */
public class StartTest {
    @BeforeClass
    public void setUp() {
        // code that will be invoked when this test is instantiated
        System.out.println("Before class");
    }
    @AfterClass
    public void tearDown() {
        // code that will be invoked when this test is finished
        System.out.println("After class");
    }
    @AfterTest
    public void tearDownTest() {
        // code that will be invoked when this test is finished
        System.out.println("After test");
    }
    @BeforeTest
    public void setUpTest() {
        // code that will be invoked when this test is instantiated
        System.out.println("Before test");
    }

    @BeforeMethod
    public void setUpMethod() {
        // code that will be invoked when this test is instantiated
        System.out.println("Before method");
    }
    @AfterMethod
    public void tearDownMethod() {
        // code that will be invoked when this test is finished
        System.out.println("After method");
    }
    @AfterGroups("slow")
    public void tearDownGroups() {
        // code that will be invoked when this test is finished
        System.out.println("After slow groups");
    }
    @BeforeGroups("slow")
    public void setUpGroups() {
        // code that will be invoked when this test is instantiated
        System.out.println("Before slow groups");
    }
    @BeforeSuite
    public void setUpSuite() {
        // code that will be invoked when this test is instantiated
        System.out.println("Before suite");
    }
    @AfterSuite
    public void tearDownSuite() {
        // code that will be invoked when this test is finished
        System.out.println("After suite");
    }

    @Test(groups = {"fast"})
    public void aFastTest() {
        System.out.println("Fast test");
    }

    @Test(groups = {"slow"})
    public void aSlowTest() {
        System.out.println("Slow test");
    }
}
